<template>
    <view class="container" :style="themeColor">
        <product-temp :tempType="0" isClass :currentClass="typeId" :classId="classid" :ProductLineIds="ProductLineIds"
            :isOnShow="isOnShow" @upCart="upCart"></product-temp>
        <show-modal></show-modal>
    </view>
</template>

<script>
import productTemp from "@/pages_classify/packet/product/productTemp.vue"
import { getUserCarList } from "@/utils/cartUtil.js"
export default {
    components: {
        productTemp,
    },
    data() {
        return {
            isOnShow: true,
            typeId: "",
            classid: "",
            ProductLineIds: "",
        }
    },
    methods: {
        upCart(isOnShow) {
            this.isOnShow = isOnShow
            //离开页面 同步购物车  TODO 增加条件 有变更 再同步
            getUserCarList().then((res) => {
                this.isChangeCart = false
            })
        },
    },
    onLoad(e) {
        this.typeId = e.typeId
        this.classid = e.classid
        if (e.ProductLineIds) {
            this.ProductLineIds = e.ProductLineIds
        }
    },
    onShow() {
        this.isOnShow = true
    },
    onHide() {
        this.upCart(false)
    },
    computed: {},
}
</script>

<style lang="scss"></style>
